<% instance_count = state_counts['total'] %>
<% if instance_count == 0 %>
	<li class="status-marker">
		<div class="marker">
			<%= status_marker('health', bom_status, state_to_label(bom_status)) %>
		</div>
		<div class="description">
			<ul>
				<li><%= icon('eye-slash') %> <%= scope %> has <b>NO</b> deployed instances</li>
				<li><%= icon('info-circle') %> Health monitoring will begin when component instances are deployed</li>
			</ul>
		</div>
	</li>
<% elsif state_counts.size == 1 && instance_count > 0 %>
  <li class="status-marker">
    <% state = 'unknown' %>
    <div class="marker"><%= health_marker(state) %></div>
 		<div class="description">
 			<ul><li><%= icon(health_icon(state), nil, 'fa-fw') %> Failed to retrieve health info</li></ul>
 		</div>
 	</li>
<% else %>
	<li class="status-marker">
    <% states = %w(unhealthy notify overutilized underutilized good)
       state = states.find {|s| state_counts[s]} %>
		<div class="marker"><%= health_marker(state) %></div>
		<div class="description">
			<ul>
        <% if state == 'good' && instance_count == state_counts['good'].to_i %>
          <li><%= icon('check') %> All <b><%= instance_count %></b> <%= scope %> instances are in <%= content_tag(:b, state, :class => health_to_text(state)) %> health</li>
        <% else %>
          <% states.each do |s| %>
            <% count = state_counts[s].to_i %>
            <% if count > 0 %>
              <% text_class = health_to_text(s) %>
              <li><%= icon(health_icon(s), nil, "fa-fw #{text_class}") %> Found <b><%= pluralize(count, 'instance') %></b> that are <%= content_tag(:b, s, :class => text_class) %></li>
            <% end %>
          <% end %>
        <% end %>
			</ul>
		</div>
	</li>
<% end %>
